package Prova;

use strict;
use warnings;
use Constants;
use Data::Dumper;

# Set flags and add plugins for the application
#
#         -Debug: activates the debug mode for very useful log messages
#   ConfigLoader: will load the configuration from a YAML file in the
#                 application's home directory
# Static::Simple: will serve static files from the application's root
#                 directory

use Catalyst qw/-Debug ConfigLoader Session Session::Store::FastMmap Session::State::Cookie I18N Static::Simple/;

our $VERSION = '0.01';

# Configure the application.
#
# Note that settings in Prova.yml (or other external
# configuration file that you set up manually) take precedence
# over this when using ConfigLoader. Thus configuration
# details given here can function as a default configuration,
# with a external configuration file acting as an override for
# local deployment.

__PACKAGE__->config(
    name   => 'Prova',
    root   => Prova->path_to('root'),
    static => {
        dirs              => [ 'static', qr/^(images|css|js)/ ],
        include_path      => [ Prova->path_to('root') ],
        ignore_extensions => [],
        no_logs           => 1
    }
);

# Start the application
__PACKAGE__->setup;

=head1 NAME

Prova - Catalyst based application

=head1 SYNOPSIS

    script/prova_server.pl

=head1 DESCRIPTION

[enter your description here]

=head1 METHODS

=head2 auto

auto action

=cut

sub auto : Private {
    my ( $self, $c ) = @_;

    $c->forward('/account/select_language');

    return $c->forward('/account/login_check');
}

=head2 default

default action

=cut

sub default : Private {
    my ( $self, $c ) = @_;

    #$c->forward('/overview/index');
    $c->stash->{'template'} = 'overview/index.tt';
}

=head2 end

end action

=cut

sub end : Private {
    my ( $self, $c ) = @_;
    return 1 if $c->response->status =~ /^(?:204|3\d\d)$/;
    $c->forward('Prova::View::TT') unless $c->response->body;
}

=head1 SEE ALSO

L<Prova::Controller::Root>, L<Catalyst>

=head1 AUTHOR

Shanon Inc, E<lt>http://www.shanon.co.jp/E<gt>

=head1 LICENSE

This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

1;
